perf(next-plugin): profile and reuse Turbopack prewarm output - #645
perf(next-plugin): profile and reuse Turbopack prewarm output#645owjs3901 wants to merge 25 commits into
Conversation
Changepacks@devup-ui/wasm@1.0.78 - bindings/devup-ui-wasm/package.jsonMaybe you forgot to write the following files to the latest version @devup-ui/next-plugin@1.0.83 - packages/next-plugin/package.jsonMaybe you forgot to write the following files to the latest version |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
c417e05 to
679c2ec
Compare
|
Final CI at 4858b33 is green: benchmark, publish (build/package/tarball/lint/full tests/landing E2E/Codecov), and landing-next-e2e all passed. Existing benchmark.js six-cold-sample medians: Tailwind Turbo 6.81s, Devup static .css.ts 6.78s, Devup direct APIs/singleCss 6.81s. The static target is 30ms faster by independent medians and about 20ms faster by the median of same-round deltas, but the ranges overlap, so this is a narrow win/parity within runner noise. Dynamic .css.ts still falls back to full Boa; the prior fair run was 6.55s vs Tailwind 6.47s, so no dynamic-full win is claimed. Run: https://github.com/dev-five-git/devup-ui/actions/runs/33231944233 |
Summary
DEVUP_UI_PROFILE=1structured Turbopack timings for graph setup, production prewarm, coordinator extraction, snapshots, serialization, and writessingleCssand per-file mode, avoiding duplicate WASM extraction and duplicate snapshot/write work on repeated Turbopack loader requestsstyle({...}).css.ts/.css.jsmodules to Devupcss({...})before extraction, allowing those builds to use the lite engine; variables, calls, spreads, extra statements, theme APIs, development mode, and source-map builds retain the full Boa enginebenchmark.jscomparison cold and order-balanced: clear.next,dist,df, andtsconfig.tsbuildinfo, use Turbopack for all three compared targets, alternate order, and report six-sample mediansNo separate benchmark workflow was added.
bun.lockremains unrelated and excluded. The add-bench PR was not touched.Correctness boundary
The static fast path accepts only one
styleimport and exportedstyle()calls whose values are recursively static objects, arrays, strings, numbers, booleans, ornull. Anything executable or unsupported fails closed to the existing full evaluator. Watch mode and production browser source maps always use full WASM. Public React declarations and theme inference are unchanged.An actual production Turbopack build of the vanilla fixture selected
wasmVariant:"lite"; its generated CSS matched the previous full build, prewarm extraction was 0.69 ms on the build config evaluation, and every loader request was a byte-identical cache hit withextractMs:0. An actual build after changing the fixture to use a local variable selectedwasmVariant:"full"and also succeeded; that temporary fixture change was reverted.Validation
Existing benchmark.js CI results
All rows are six cold samples in the existing Publish workflow. Initial one-shot records are excluded from medians.
4858b339Tailwind Turbo4858b339Devup static.css.ts4858b339Devup direct APIs / singleCss4b94b161Tailwind Turbo4b94b161Devup full Boa.css.tsThe optimized static
.css.tsfixture is 30 ms faster by independent medians; the median of its six same-round Devup-minus-Tailwind deltas is about -20 ms. The ranges overlap, so the defensible conclusion is a narrow win/parity within CI-runner noise, not a universal performance victory. Dynamic.css.tsstill takes the full Boa path; the prior fair run was 80 ms slower by independent medians, so this PR does not claim a dynamic-full victory.Rejected experiments and benchmark limits
-O3increased WASM size/package-build time and regressed the CI median; compactz/-Ozsettings remainThe fixtures are not semantically identical: Tailwind uses untyped class strings and emits framework CSS, while Devup validates typed style props and emits much less CSS. The benchmark is useful for regression/directional evidence, not proof that either library is always faster. Type checking and inference were deliberately not weakened.